package com.wongsir.springboot.redis.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;

import com.wongsir.springboot.redis.service.RedisService;

/**
 * redis操作
 * @author wongsir
 * @date 2018年9月17日
 */
@Service
public class RedisServiceImpl implements RedisService {
	
	@Autowired
	private RedisTemplate<String,Object> redisTemplate;
//	@Resource(name="redisTemplate")
//	private ValueOperations<String,Object> vos;

	@Override
	public void set(String key, Object value) {
		ValueOperations<String, Object> vos = redisTemplate.opsForValue();
		vos.set(key, value);
	}

	@Override
	public Object get(String key) {
		ValueOperations<String, Object> vos = redisTemplate.opsForValue();
		return vos.get(key);
	}

}
